<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" name="viewport" content="width-device-width,initial-scale=1">
    <title>长流登录</title>
    <!-- 引入 Bootstrap -->
    <script src="/js/jquery.min.js"></script>
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/css/formcss.css" >
    <script type="text/javascript">
        var onClickLogin = function() {
            $.ajax({
                type: 'POST',
                contentType: 'application/json:charset=utf-8',
                url: '/home/login/'+ $("input[name=name]").val()+"/"+ $("input[name=pwd]").val(),
                dataType: 'json',
                success: function (data) {
                    var result = data['message'];
                    if(result=="登录成功"){
                        sessionStorage.sessionId = data['result'];
                        window.location.replace("/");
                    }
                    alert(result);
                },
                error: function (err) {
                    alert(JSON.stringify(err));
                }
            })
        };
    </script>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-offset-3 col-md-6">
            <form class="form-horizontal" method="post" action="/login" id="LoginForm">
                <span class="heading">用户登录</span>
                <div class="form-group">
                    <input type="text" class="form-control" name="name"  placeholder="用户名">
                    <i class="fa fa-user"></i>
                </div>
                <div class="form-group help">
                    <input type="password" class="form-control" name="pwd"  placeholder="密　码">
                    <i class="fa fa-lock"></i>
                    <a href="#" class="fa fa-question-circle"></a>
                </div>
                <div class="form-group">
                    <div class="main-checkbox">
                        <input type="checkbox" value="None" id="checkbox1" name="check"/>
                        <label for="checkbox1"></label>
                    </div>
                    <span class="text">Remember me</span>
                    <button type="button" class="btn btn-default" onclick="onClickLogin()">登录</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>